<template>
  <div>
   count: {{ counterStore.count }}
   count: {{ count }}
  </div>
</template>

<script setup>
import {toRefs} from 'vue'
import {storeToRefs} from 'pinia'
// 组件中使用pinia stores定义 
import useCounter from '@/stores/counter'
const counterStore=useCounter()
// 直接解构失去响应式  toRefs 对象里面属性转换成响应式的。
// const {count} =toRefs(counterStore)
const {count} =storeToRefs(counterStore)

</script>

<style>

</style>